Popular Searches
Popular Course Categories
Popular Courses

Recording, Running, and Editing Macros

Recording, Running, and Editing Macros

Excel Macros and VBA Automation

Building Reports from Related Tables in Microsoft Excel

Course: Advanced Excel

Topic: Building Reports from Related Tables

Course Link: Advanced Excel Training at JustAcademy

Demo Link: Register for a Course Demo

Website: Visit JustAcademy


1. Introduction to Reports from Related Tables

Building reports from related tables is an important advanced Excel skill used to analyze information stored across multiple datasets. In business environments, customer details, sales transactions, product information, employee records, budgets, and dates are often maintained in separate tables. Excel allows these tables to be connected through relationships so users can create reports without manually combining every column into one large worksheet.

Excel's Data Model and Power Pivot features support this process. Once the tables are loaded into the Data Model and connected through valid relationships, a PivotTable or PivotChart can use fields from different tables in the same report.

For example, a sales report can combine CustomerName from a Customers table, ProductCategory from a Products table, OrderDate from a Calendar table, and SalesAmount from a Sales table. This makes it possible to analyze sales by customer, category, region, month, and year.

2. Learning Objectives

  • Understand how related tables support advanced Excel reporting.
  • Prepare tables for use in the Excel Data Model.
  • Identify primary keys, foreign keys, and relationship types.
  • Create and validate relationships between tables.
  • Build PivotTables using fields from multiple related tables.
  • Summarize data using values, measures, filters, and slicers.
  • Create reports for sales, products, customers, and time periods.
  • Use PivotCharts to visualize results.
  • Troubleshoot incorrect totals, missing data, and relationship errors.
  • Apply best practices for accurate, refreshable business reports.

3. What Is a Related-Table Report?

A related-table report is a report that combines fields from two or more tables connected through common identifiers. Instead of repeating all descriptive information in a transaction table, Excel uses relationships to connect the tables when calculating or displaying the report.

For example, a Sales table may contain CustomerID and ProductID rather than the full customer name and product category. These identifiers connect the Sales table to the Customers and Products tables.

Example of Separate Tables

Customers table

CustomerID CustomerName Region
C101 Aarav Sharma West
C102 Priya Patel South
C103 Rahul Verma North

Products table

ProductID ProductName Category
P101 Laptop Electronics
P102 Mouse Accessories
P103 Monitor Electronics

Sales table

OrderID CustomerID ProductID SalesAmount
O501 C101 P101 50000
O502 C102 P102 4000
O503 C101 P103 12000
O504 C103 P101 48000

These tables store different types of information. Relationships allow Excel to connect the records and produce reports using customer names, product categories, regions, and sales amounts together.

4. Understanding the Excel Data Model

The Data Model is a collection of related tables stored within an Excel workbook. It provides a foundation for creating PivotTables and PivotCharts that use fields from different tables.

Rather than merging all data into a single worksheet, the Data Model keeps tables separate and connects them through relationships. This structure can reduce repeated descriptive data and make reporting more manageable.

Benefits of the Data Model

  • Combines information from multiple tables and data sources.
  • Supports relationships between lookup tables and transaction tables.
  • Allows PivotTables to use fields from different related tables.
  • Supports DAX measures for reusable business calculations.
  • Works with Power Query workflows for importing and preparing data.
  • Helps organize large reporting models more clearly.

For more information, see Microsoft's guide: Create a Data Model in Excel.

5. Understanding Table Relationships

A relationship connects two tables through matching values in their key columns. For a standard one-to-many relationship, the lookup table contains unique key values, while the related transaction table can contain repeated values.

Example: Customer Relationship

Customers[CustomerID] connects to Sales[CustomerID]. One customer can have many sales transactions, so Customers is on the one side and Sales is on the many side.

Customers (1) → Sales (*)

Example: Product Relationship

Products[ProductID] connects to Sales[ProductID]. One product may appear in many sales transactions.

Products (1) → Sales (*)

Important Relationship Rules

  • The lookup-side key must contain unique values.
  • The connected columns must have compatible data types.
  • Key values should be consistent and properly cleaned.
  • Transaction records should reference valid lookup keys.
  • Relationships should provide a clear path for filtering and summarization.

For further guidance, read Microsoft's article: Create a Relationship Between Tables in Excel.

6. Preparing Data Before Building Reports

Reliable reports begin with clean, well-structured source data. Before building a report, inspect each table and confirm that the data is suitable for analysis.

Step 1: Organize the Data

Separate data according to its purpose. For example, keep customer information in Customers, product details in Products, transaction records in Sales, and dates in Calendar.

Step 2: Convert Ranges into Excel Tables

  1. Select a cell within the dataset.
  2. Press Ctrl + T, or choose Insert > Table.
  3. Confirm the data range.
  4. Select My table has headers if the first row contains column names.
  5. Click OK.

Step 3: Rename Each Table

  1. Select a cell in the table.
  2. Open the Table Design tab.
  3. Enter a descriptive name in the Table Name field.
  4. Use names such as Customers, Products, Sales, and Calendar.

Step 4: Check Data Quality

  • Remove unnecessary blank rows and columns.
  • Correct inconsistent column headings.
  • Standardize dates, numbers, and text identifiers.
  • Check for duplicate keys in lookup tables.
  • Identify blank or unmatched identifiers.
  • Confirm that sales amounts and quantities use suitable numeric formats.

Step 5: Add Tables to the Data Model

Depending on the Excel version and workflow, you can use Power Pivot > Add to Data Model or load data through Power Query and select the option to add it to the Data Model. When importing multiple related tables together, Excel may create a Data Model automatically.

7. Creating Relationships Between Tables

Once the tables are ready and loaded into the Data Model, create relationships between their matching key columns.

Method A: Using Data > Relationships

  1. Open the Data tab.
  2. Select Relationships.
  3. Click New in the Manage Relationships dialog box.
  4. Choose the table containing the foreign key, such as Sales.
  5. Select the matching column, such as CustomerID.
  6. Choose the related lookup table, such as Customers.
  7. Select its unique CustomerID column.
  8. Click OK to create the relationship.
  9. Repeat for other required relationships, such as Sales to Products.

Method B: Using Power Pivot Diagram View

  1. Open Power Pivot > Manage.
  2. Select Diagram View.
  3. Locate the tables that need to be connected.
  4. Drag the lookup table's key field to the corresponding field in the transaction table, if supported by the interface.
  5. Review the relationship line and the one-to-many markers.
  6. Open Manage Relationships to confirm the selected columns.

Menu names and feature availability may vary by Excel edition and platform. Some Excel environments have limited Data Model or Power Pivot support.

8. Building a PivotTable from Related Tables

A PivotTable is one of the most useful tools for creating reports from related tables. It summarizes data and allows users to analyze results by different dimensions.

Step-by-Step Procedure

  1. Confirm that the required tables are included in the Data Model.
  2. Verify that the relationships between the tables are correct.
  3. Open the Insert tab and select PivotTable, choosing the Data Model as the source where required.
  4. Choose whether to place the PivotTable in a new worksheet or an existing worksheet.
  5. Click OK to create the PivotTable.
  6. Review the PivotTable Fields pane, which should list the available tables.
  7. Expand the Customers table and drag CustomerName to Rows.
  8. Expand the Sales table and drag SalesAmount to Values.
  9. Check that the value field is summarized by Sum where appropriate.
  10. Format the report and confirm the grand total against the source data.

When relationships are correct, Excel can combine fields from related tables without manually copying all descriptive fields into the transaction table.

Microsoft's step-by-step reference: Use Multiple Tables to Create a PivotTable in Excel.

9. Example: Building a Sales Report by Customer

Suppose a company wants to understand how much each customer has purchased. The Customers table stores customer names, while the Sales table stores individual transactions.

Source Data

OrderID CustomerID SalesAmount
O501 C101 50000
O502 C102 4000
O503 C101 12000
O504 C103 48000
O505 C102 6000

PivotTable Field Setup

PivotTable Area Field
Rows Customers[CustomerName]
Values Sales[SalesAmount] summarized by Sum

Expected Report

CustomerName Total Sales
Aarav Sharma 62000
Priya Patel 10000
Rahul Verma 48000
Grand Total 120000

This report combines CustomerName from Customers with SalesAmount from Sales. The relationship ensures that each transaction contributes to the correct customer's total.

10. Building a Sales Report by Product Category

A product-category report helps managers understand which product groups generate the most revenue.

PivotTable Field Setup

PivotTable Area Field
Rows Products[Category]
Values Sales[SalesAmount] summarized by Sum

Using the example data, the Electronics category includes the Laptop and Monitor sales. Accessories includes the Mouse sales.

Category Total Sales
Electronics 110000
Accessories 4000
Grand Total 114000

The report allows users to compare categories and identify areas that contribute most to sales. These figures use the sample records shown in this section and are intended to demonstrate the reporting method.

11. Building Reports by Region and Product

Reports can combine fields from more than two related tables. For example, the Customers table provides Region, the Products table provides Category, and the Sales table provides SalesAmount.

Example Field Arrangement

  • Rows: Customers[Region]
  • Columns: Products[Category]
  • Values: Sales[SalesAmount]
  • Filters: Order year or another available reporting field

This layout creates a matrix showing sales by region and product category. Managers can use it to compare regional performance, identify strong categories, and investigate underperforming areas.

When the report uses fields from different tables, confirm that the relationships provide a valid filter path between those tables.

12. Building Reports by Month and Year

Time-based reports help businesses understand trends, seasonality, growth, and changes in performance. A Calendar table provides reusable date attributes for reports.

Recommended Calendar Table Fields

Field Purpose
Date Unique date key for the relationship.
Month Displays the month name or month number.
Quarter Groups dates into quarters.
Year Groups transactions by year.

Steps to Build a Monthly Report

  1. Ensure the Calendar table contains unique dates covering the relevant transaction dates.
  2. Connect Calendar[Date] to the appropriate date column in Sales.
  3. Create a PivotTable from the Data Model.
  4. Drag Calendar[Year] and Calendar[Month] to Rows or Columns.
  5. Drag Sales[SalesAmount] or a Total Sales measure into Values.
  6. Sort the months chronologically rather than alphabetically.
  7. Format the totals and check them against the original transaction data.

A dedicated Calendar table is particularly useful for consistent date grouping across reports. For more advanced time-intelligence calculations, the model may need a properly configured date table and suitable DAX measures.

13. Using Measures in Related-Table Reports

Measures provide reusable calculations that respond to the current report context. They are useful when the report needs more than a simple sum.

Example 1: Total Sales

Total Sales = SUM(Sales[SalesAmount])

Example 2: Total Profit

Total Profit = SUM(Sales[Profit])

This assumes that the Sales table already contains a valid Profit column or that Profit is otherwise available as a suitable numeric field.

Example 3: Order Count

Order Count = DISTINCTCOUNT(Sales[OrderID])

Distinct count is useful when one order may occupy multiple rows because it contains multiple products.

Example 4: Average Sales Amount

Average Sales Amount = AVERAGE(Sales[SalesAmount])

Example 5: Profit Margin

Profit Margin % = DIVIDE([Total Profit], [Total Sales], 0)

This calculates total profit divided by total sales for the current filter context. Format the measure as a percentage.

Measures can be added to the Values area of a PivotTable and analyzed by customer, region, category, or time period. The results change according to the active filters and relationships.

14. Adding Filters and Slicers to Reports

Filters and slicers make reports interactive. They allow users to focus on a selected region, product category, customer, or time period without rebuilding the PivotTable.

Using PivotTable Filters

  1. Click the PivotTable.
  2. Drag a suitable field into the Filters area.
  3. Use the filter dropdown to select the desired value.
  4. Review how the totals change.

Using Slicers

  1. Select a cell in the PivotTable.
  2. Open the PivotTable Analyze tab.
  3. Select Insert Slicer.
  4. Choose fields such as Region, Category, or CustomerName.
  5. Click OK.
  6. Use the slicer buttons to filter the report.

Using a Timeline

If the PivotTable supports it and contains an appropriate date field, insert a Timeline to filter records by year, quarter, month, or day. Availability depends on the Excel version and PivotTable source.

Best practice: If a workbook contains multiple PivotTables, use Report Connections or PivotTable Connections where available to connect a slicer to the intended reports. A slicer does not necessarily control every PivotTable automatically.

15. Creating PivotCharts from Related Tables

A PivotChart presents the results of a PivotTable visually. It is useful for identifying trends, comparing categories, and communicating findings to stakeholders.

Steps to Create a PivotChart

  1. Select a cell in the PivotTable.
  2. Open the Insert tab or PivotTable Analyze tab, depending on the Excel version.
  3. Choose PivotChart.
  4. Select a chart type suitable for the data.
  5. Add a descriptive chart title.
  6. Check the axis labels, legend, and number formats.
  7. Use associated slicers or filters to explore different views.

Choosing an Appropriate Chart

Report Purpose Recommended Chart
Compare sales by region Clustered column or bar chart
Track sales over time Line chart
Compare product categories Bar or column chart
Show contribution to a whole Stacked chart or pie chart for a small number of categories
Compare actual sales with targets Clustered column chart or suitable variance visualization

Choose charts based on the question the report needs to answer. Avoid unnecessary 3D effects, crowded labels, and too many colors.

16. Designing a Professional Excel Report

A good report should be accurate, easy to understand, and organized around the decisions its audience needs to make.

Recommended Report Structure

  • Report title: Clearly state the subject and period.
  • Key metrics: Display total sales, total profit, order count, or other relevant measures.
  • Summary table: Present the main results by region, product, or customer.
  • Trend chart: Show changes over time when relevant.
  • Comparison chart: Compare categories or regions.
  • Filters: Add slicers for the dimensions users need to explore.
  • Notes: Explain important definitions, assumptions, or data limitations.
  • Refresh information: Indicate the reporting period or last refresh date where useful.

Formatting Best Practices

  • Use consistent fonts and number formats.
  • Apply currency formats to financial values.
  • Display percentages with a sensible number of decimal places.
  • Use descriptive headings and clear chart titles.
  • Keep important totals easy to locate.
  • Use conditional formatting only where it helps interpretation.
  • Avoid excessive merged cells and decorative formatting.
  • Arrange slicers consistently and leave enough space for report content.

17. Refreshing Reports After Source Data Changes

Reports are only useful when they reflect the latest available data. The required refresh process depends on how the tables are connected to the workbook.

Refresh Procedure

  1. Update the source data or add the new records.
  2. Confirm that the new records are included in the source Excel table or query.
  3. Open the Data tab.
  4. Choose Refresh All when appropriate, or refresh the relevant query or connection.
  5. Allow the Data Model and PivotTables to update.
  6. Review the report totals and confirm that new records appear.
  7. Check whether the reporting period and labels need updating.

Linked Excel tables may synchronize changes automatically depending on the configuration, while imported queries and external sources may require a refresh. Always verify the actual refresh behavior of the workbook.

18. Common Reporting Problems and Solutions

Problem 1: Fields from Different Tables Cannot Be Combined

Cause: The tables may not have a valid relationship, or there may be no unambiguous relationship path between them.

Solution: Open Data > Relationships or Power Pivot Diagram View. Confirm that the relevant tables are connected through the correct key columns.

Problem 2: Duplicate Values on the Lookup Side

Cause: The column intended to be the unique side of a relationship contains duplicate values.

Solution: Investigate duplicates and correct the table design. Keep unique identifiers in the lookup table and repeated foreign keys in the transaction table where appropriate.

Problem 3: Incorrect Grand Totals

Cause: The relationship may be incorrect, the transaction data may contain duplicates, or the selected aggregation may not match the business requirement.

Solution: Check the relationships, inspect source transactions, confirm whether Sum, Count, or Distinct Count is appropriate, and reconcile the totals against the source data.

Problem 4: Sales Are Repeated Across Categories

Cause: The category table may not be connected correctly to the sales table, or the model may contain an ambiguous filtering path.

Solution: Check the ProductID relationship, ensure the lookup-side key is unique, and review the model's relationship paths.

Problem 5: Some Records Do Not Appear

Cause: A transaction may contain a key that does not exist in the lookup table, or a filter may be excluding records.

Solution: Inspect unmatched identifiers, review active filters, and confirm that all relevant source rows were imported and refreshed.

Problem 6: Months Appear in Alphabetical Order

Cause: The report may be sorting month names as text.

Solution: Use a month number or date-based field to sort the month names chronologically. A Calendar table is often the best approach.

Problem 7: A Slicer Does Not Filter Every Report

Cause: The slicer may not be connected to every relevant PivotTable, or the PivotTables may use different sources or models.

Solution: Review Report Connections or PivotTable Connections and connect the slicer to the intended reports where supported.

Problem 8: Report Does Not Show New Data

Cause: The source table range, query, Data Model, or PivotTable has not been updated correctly.

Solution: Check the source range and query settings, run the required refresh process, and verify that the new records are included.

19. Best Practices for Reports Built from Related Tables

  • Use a well-organized Data Model instead of repeatedly merging the same descriptive columns.
  • Use meaningful table and column names.
  • Maintain unique keys in lookup tables.
  • Use compatible data types in related columns.
  • Prefer clear one-to-many relationships where they correctly represent the data.
  • Avoid unnecessary relationships that create ambiguous filtering paths.
  • Use measures for reusable calculations such as total sales and profit margin.
  • Use distinct counts when the business question requires counting unique customers or orders.
  • Validate totals and sample records before sharing reports.
  • Document assumptions and calculation definitions.
  • Refresh the Data Model and PivotTables after relevant source updates.
  • Keep report design simple, consistent, and focused on business questions.
  • Protect important formula cells and report layouts where appropriate.
  • Save a backup before making major changes to the model.

20. Practical Exercises

Exercise 1: Customer Sales Report

Create Customers and Sales tables. Relate them through CustomerID. Build a PivotTable showing customer names and total sales.

Expected outcome: Sales transactions are summarized under the correct customer.

Exercise 2: Product Category Report

Create Products and Sales tables. Relate them through ProductID. Build a report showing total sales by product category.

Expected outcome: The report summarizes sales across categories without manually copying category names into the Sales table.

Exercise 3: Regional Performance Report

Use Customers[Region] and Sales[SalesAmount]. Build a PivotTable comparing total sales by region, then add a chart to visualize the results.

Expected outcome: Users can identify which regions generate the highest sales.

Exercise 4: Monthly Sales Report

Create a Calendar table with unique dates. Relate it to the transaction date in Sales. Build a report that summarizes sales by month and year.

Expected outcome: Sales totals can be analyzed chronologically and filtered by reporting period.

Exercise 5: Interactive Dashboard

Create PivotTables for sales by customer, product category, and region. Add PivotCharts and slicers for region and category. Connect slicers to the relevant reports where supported.

Expected outcome: The dashboard allows users to explore multiple views of the same model.

21. Mini Project: Build a Multi-Table Sales Dashboard

Project objective: Build an interactive Excel dashboard using related tables in the Data Model.

Required Tables

  • Customers: CustomerID, CustomerName, City, Region.
  • Products: ProductID, ProductName, Category.
  • Sales: OrderID, CustomerID, ProductID, OrderDate, Quantity, SalesAmount, Profit.
  • Calendar: Date, Month, Quarter, Year.

Project Steps

  1. Clean the source datasets and standardize column types.
  2. Convert the datasets into Excel tables and give each table a descriptive name.
  3. Load the tables into the Data Model.
  4. Create the required relationships between Customers, Products, Calendar, and Sales.
  5. Check that lookup keys are unique and transaction keys match valid records.
  6. Create a Total Sales measure and other metrics required by the report.
  7. Build a PivotTable for sales by region.
  8. Build a PivotTable for sales by product category.
  9. Build a PivotTable for sales by month and year.
  10. Create PivotCharts that suit the reporting questions.
  11. Add slicers for Region, Category, and other useful fields.
  12. Organize the charts and summary metrics into a clear dashboard layout.
  13. Validate grand totals and test that filters affect the intended reports.
  14. Refresh the workbook and confirm that the reporting workflow works as expected.

Suggested Dashboard Components

Component Purpose
Total Sales metric Displays the overall sales amount for the selected context.
Total Profit metric Displays the profit for the selected context.
Sales by Region chart Compares performance across regions.
Sales by Category chart Shows the contribution of product categories.
Monthly Sales chart Highlights changes in sales over time.
Region slicer Filters reports to selected regions.
Category slicer Filters reports to selected product categories.

Project Deliverables

  • An Excel workbook containing all source tables.
  • A Data Model with valid relationships.
  • PivotTables built from fields in related tables.
  • PivotCharts and interactive filters.
  • A dashboard with clear headings and consistent formatting.
  • A validation checklist confirming the report totals.

22. Interview Questions and Answers

Q1. What does it mean to build a report from related tables?

Answer: It means using fields from two or more connected tables in a single report, usually through the Excel Data Model and PivotTables.

Q2. What is the Excel Data Model?

Answer: It is a collection of related tables stored within a workbook that supports multi-table analysis, PivotTables, PivotCharts, and calculations.

Q3. Why are relationships needed?

Answer: Relationships tell Excel how records in different tables correspond, allowing fields from those tables to be combined and summarized correctly.

Q4. What is the difference between a lookup table and a transaction table?

Answer: A lookup table stores unique identifiers and descriptive attributes, while a transaction table stores individual business events and often contains repeated foreign keys.

Q5. Can a PivotTable use fields from multiple tables?

Answer: Yes. When the tables are included in the Data Model and related appropriately, their fields can be used together in a PivotTable.

Q6. Why should lookup keys be unique?

Answer: The unique lookup key identifies one record on the one side of a standard one-to-many relationship. Duplicate keys can prevent the relationship from being created.

Q7. What is the purpose of a Calendar table?

Answer: A Calendar table provides consistent date, month, quarter, and year attributes for reporting and time-based analysis.

Q8. How do measures help in related-table reporting?

Answer: Measures provide reusable calculations that respond to the current report filters, such as total sales, total profit, and profit margin.

Q9. What should you do if the report totals are incorrect?

Answer: Verify the relationships, source data, aggregation methods, duplicate records, filters, and measure definitions. Reconcile the results against the original data.

Q10. What is the difference between a PivotTable and a PivotChart?

Answer: A PivotTable summarizes information in a tabular layout, while a PivotChart presents related summary data visually.

Q11. Why might a slicer not control every PivotTable?

Answer: The slicer may not be connected to every report, or the reports may use different sources or models. Report Connections can be used where supported.

Q12. How do you keep related-table reports updated?

Answer: Update the source data, refresh the relevant queries or Data Model where required, refresh the PivotTables, and verify the resulting totals.

23. Quick Revision Checklist

  • Prepare clean Excel tables with meaningful names.
  • Add the required tables to the Data Model.
  • Create valid relationships using compatible key columns.
  • Check that lookup keys are unique.
  • Build PivotTables using fields from related tables.
  • Place dimensions in Rows, Columns, or Filters as needed.
  • Place numeric fields or measures in Values.
  • Use slicers and PivotCharts to make reports interactive.
  • Format titles, totals, dates, currency, and percentages consistently.
  • Validate results against the source data.
  • Refresh the model and reports when the data changes.

24. Conclusion

Building reports from related tables allows Excel users to analyze information across multiple datasets without manually combining every field into one worksheet. By using the Data Model, relationships, PivotTables, measures, slicers, and PivotCharts, users can create flexible reports for sales analysis, product performance, customer reporting, and time-based comparisons.

The most important steps are to prepare the data carefully, establish valid relationships, choose the correct fields and aggregation methods, and validate the results. A well-designed model makes reporting more consistent, maintainable, and useful for business decision-making.

To develop more advanced Excel reporting skills, explore JustAcademy's Advanced Excel course, register for a course demo, or visit the JustAcademy website.

Previous Next
whatsapp